package com.dp.prototype.case01;

import java.util.Random;

/**
 * @Author: Ruomeng
 * @Date: 2024/11/27
 * @Description : design-pattern
 * 具体应用场景
 * @Version: 1.0
 */
public class Client {

    // 发送邮件的数量
    private static int MAX_COUNT = 6;

    public static void sendMail(Mail mail) {
        System.out.println("subject: " + mail.getSubject() + "\t receiver: " + mail.getReceiver()
                + "\t ... 发送成功");
    }

    public static void main(String[] args) {
        int i = 0;
        // 定义模板
        Mail mail = new Mail(new AdvTemplate());
        mail.setTail("xxx");
        while (i < MAX_COUNT) {
            mail.setAppellation(" Mr");
            Random random = new Random();
            int num = random.nextInt(999999999);
            mail.setReceiver(num + "@" + ".com");
            // 发送邮件
            sendMail(mail);
            i++;
        }
    }
}
